var work={
	/*·····························初始化························*/
	init:function(){
		this.eventListen();
		this.getDict();
	},
	/*·····························事件监听························*/
	eventListen:function(){
		// 按钮颜色切换和取值放入隐藏域
		$(document).on("click","#buttonGroup button",function(){
			$("#Bcate").attr("value",$(this).text());
			$("#buttonGroup button").removeClass("btn-primary");
			$(this).addClass("btn-primary");
			var signId="#Scate";
			var type=$(this).attr("type");
			work.getDict(signId,type);
		});
		//表单提交
		$(document).on("click","#formSub",function(){
			work.formsub();
		});
	},
	/*·····························功能性函数························*/
	// iframe页面弹窗
	layerOpen:function(title,url){
		layer.open({
			type: 2,
			area: ['800px', '600px'],
			fix: false, //不固定
			maxmin: true,
			shade:0.4,
			title: title,
			content:url,
		});
	},
	getDict:function(signId,type){
		var signId=(signId)?signId:"#Scate";
		var type=(type)?type:"maintain1";
		$.post("/index.php?m=Admin&c=Dict&a=getdict",{type:type},function(data){
				if(data){
					var str="";
					for(x in data){
						str+='<option value="'+data[x]['text']+'">'+data[x]['text']+'</option>';
					}
					$(signId).empty();
					$(signId).append(str);
				}else{
					$(signId).empty();
				}
		});
	},
	/*·····························插件初始化························*/
	formsub:function(){
	        $("#form-customer-add").ajaxSubmit({
	        type:'POST',
	        url:'/index.php?m=Service&c=Order&a=send',
	        success:function(data){
	          	// alert();
	        	if(data.stat==1){
	              layer.msg("添加成功");
	              var index = parent.layer.getFrameIndex(window.name);
	              setTimeout(function(){
	                   parent.layer.close(index);
	              },1000);
	              parent.location.reload();
	            	window.location.href="/index.php?m=Service&c=Center&a=index&tel="+info.tel;
	          }else{
	            layer.msg(data.msg);
	          }
	          }
	        });
	},
}